home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / CLSTRING.HPP < prev    next >
C/C++ Source or Header  |  1993-09-02  |  4KB  |  128 lines

  1. //----------------------------------------------------------------------------
  2. //                            MODULE DESCRIPTION
  3. //
  4. //  Module:    clstring.hpp
  5. //   Title:    C++ Class Libraries
  6. //  Notice:    John M. Weeder
  7. //                 Copyright (c) 1993. All rights reserved.
  8. //             This module contains proprietary information and should be 
  9. //                treated as confidential.
  10. //
  11. //----------------------------------------------------------------------------
  12. //                           MAINTENANCE HISTORY
  13. //
  14. // $Workfile$
  15. // $Revision$
  16. //   $Author$
  17. //     $Date$
  18. //      $Log$    
  19. //
  20. //----------------------------------------------------------------------------
  21. //                             MODULE NARRATIVE
  22. //
  23. //    This module contains code for the class CL_STRING.
  24. //    This code manages dynamically allocated strings.
  25. //
  26. //    The code in this module may be written in C++ or C.
  27. //
  28. //    This module is portable to:
  29. //        DOS 3.X+
  30. //        MS Windows 3.X+
  31. //        OS/2 2.X+
  32. //        OS/2 2.0 PM
  33. //
  34. //    The following compilers are supported:
  35. //        MSC 6.0A
  36. //        MSC/C++ 7.0
  37. //        Borland C++ 3.1 for DOS
  38. //        Borland C++ 1.0 for OS/2 2.X
  39. //
  40. //----------------------------------------------------------------------------
  41.  
  42. //----------------------------------------------------------------------------
  43. //    Class CL_STRING
  44. //----------------------------------------------------------------------------
  45. CLASSDEF(CL_STRING);
  46. #define CL_STRING_PARENT CL_OBJECT
  47. class CLASSTYPE CL_STRING : public CL_STRING_PARENT
  48. {
  49. protected:
  50.     SIZET cBuf;                                    // Length of string buffer
  51.                                                     // 0 if no string allocated
  52.     PSZ pszBuf;                                    // Pointer to string, or NULL 
  53.                                                     // String is zero terminated
  54. public:
  55.     FN_M CL_STRING(SIZET = 0);
  56.     FN_M CL_STRING(SIZET, PCSZ, va_list);
  57.     FN_MV CL_STRING(PCSZ...);
  58.     FN_M CL_STRING(RCCL_STRING);
  59.     virtual FN_M ~CL_STRING();
  60.  
  61.     BOOL FN_M AppendCharCond(CHAR);
  62.     CHAR FN_M Char(SIZET = 0) const;
  63.     PSZ FN_M Chr(CHAR) const;
  64.     BOOL FN_M Concat(CHAR);
  65.     BOOL FN_M Concat(PCSZ);
  66.     BOOL FN_M Concat(PCCHAR, SIZET);
  67.     BOOL FN_M Concat(RCL_STRING);
  68.     BOOL FN_M Copy(PCSZ);
  69.     BOOL FN_M Copy(PCCHAR, SIZET);
  70.     BOOL FN_M Copy(RCCL_STRING);
  71.     SIZET FN_M Count(CHAR) const;
  72.     BOOL FN_M Create(SIZET = 0, PCSZ = NULL);
  73.     BOOL FN_M Create(SIZET, PCSZ, va_list);
  74.     virtual BOOL FN_M Destroy(BOOL = TRUE);
  75.     VOID FN_M Empty();
  76.     BOOL FN_M Extract(RCL_STRING, SHORT = 0, PCSZ = NULL) const;
  77.     ULONG FN_M Hash() const;
  78.     virtual BOOL FN_M Initialize(SHORT = CL_INIT_ALL);
  79.     SIZET FN_M IsEmpty() const
  80.         {
  81.         return !cBuf || !pszBuf[0];
  82.         }
  83.     virtual BOOL FN_M IsValid() const;
  84.     SIZET FN_M Len() const;
  85.     BOOL FN_M Lower();
  86.     RCCL_STRING FN_M operator=(RCCL_STRING);
  87.     RCL_STRING FN_M operator=(PCSZ);
  88.     RCL_STRING FN_M operator+=(CHAR);
  89.     RCL_STRING FN_M operator+=(PCSZ);
  90.     RCL_STRING FN_M operator+=(RCCL_STRING);
  91.     CHAR FN_M operator[](SIZET) const;
  92.     RCL_STRING FN_MV operator()(PCSZ psz...);
  93.     FN_M operator PSZ() const
  94.         {
  95.       return pszBuf;
  96.         }
  97.     FN_M operator PCSZ() const
  98.         {
  99.         return (PCSZ)pszBuf;
  100.         }
  101.     PSZ FN_M Ptr(SIZET = 0) const;
  102.     PSZ FN_M RChr(CHAR) const;
  103.     virtual BOOL FN_M Retrieve(PCSZ, PCSZ = NULL);
  104.     virtual BOOL FN_M Store(PCSZ, PCSZ = NULL);
  105.     BOOL FN_M Trim();
  106.     BOOL FN_M TrimLeft();
  107.     BOOL FN_M TrimRight();
  108.     BOOL FN_M Upper();
  109.     CHAR FN_M UpperChar(SIZET = 0) const;
  110.     BOOL FN_M ValidLong(PLONG = NULL) const;
  111.     BOOL FN_M ValidShort(PSHORT = NULL) const;
  112.     BOOL FN_M ValidULong(PULONG = NULL) const;
  113.     BOOL FN_M ValidUShort(PUSHORT = NULL) const;
  114.  
  115. #if COMPILE_DEBUG
  116.     static VOID FN_M Print(PCCL_STRING = NULL, PCSZ = NULL, SIZET = 0);
  117.     static BOOL FN_M Test(SHORT = 0);
  118. #endif
  119.  
  120. protected:
  121.  
  122. private:
  123.     static CHAR chNull;                        // By default, this character is null 
  124. };
  125. //----------------------------------------------------------------------------
  126. //------------------------------- End of File --------------------------------
  127. //----------------------------------------------------------------------------
  128.